Extending Deforestation for First Order functional Programs
نویسندگان
چکیده
Intermediate data structures are widely used in functional programs. Programs which use these intermediate structures are usually a lot easier to understand, but they result in loss of efficiency at run time. In order to reduce these run-time costs, a transformation algorithm called deforestation was proposed by Wadler which could eliminate intermediate structures. However, this algorithm is only applicable to a subset of all first-order functional terms. In this paper, it is shown how deforestation can be extended to be made applicable to all first-order functional terms. This is achieved by performing static analysis to determine which intermediate data structures can be eliminated. Using this extended form of deforestation, the majority of garbage which can be detected at compile-time will not be generated at run-time.
منابع مشابه
Deforestation for higher-order functional programs
Functional programming languages are an ideal medium for program optimisations based on source-to-source transformation techniques. Referential transparency affords opportunities for a wide range of correctness-preserving transformations leading to potent optimisation strategies. This thesis builds on deforestation, a program transformation technique due to Wadler that removes intermediate data...
متن کاملConstraints to Stop Deforestation
Wadler's deforestation algorithm eliminates intermediate data structures from functional programs. To be suitable for inclusion in a compiler, deforestation must terminate on all programs. Several techniques exist to ensure termination of deforestation on all rst-order programs, but general techniques for higher-order programs were introduced only recently by rst Hamilton and then Marlow. We pr...
متن کاملComparison of Deforestation Techniques for Functional Programs and for Tree Transducers
We compare transformations for the elimination of intermediate results in rst-order functional programs. We choose the well known deforestation technique of Wadler and composition techniques from the theory of tree transducers, of which the implementation of functional programs yet does not take advantage. We identify syntactic classes of function deenitions for which both techniques deliver eq...
متن کاملExtending Higher-Order Deforestation: Transforming Programs to Eliminate Even More Trees
In previous work, we have shown howWadler’s original deforestation algorithm can be extended to handle higher-order programs. A higher-order treeless form of expression was defined to ensure the termination of this algorithm. Our higher-order algorithm was further extended by Seidl and Sørensen, and this extension was shown to remove some intermediate structures not removed by our algorithm (al...
متن کاملAttribute Grammars and Functional Programming Deforestation
The functional programming community is paying increasing attention to static structure-based transformations. For example, generic control operators , such as fold, have been introduced in functional programming to increase the power and applicability of a particular kind of static transformation, called deforestation, which prevents the construction of useless intermediate data structures in ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1991